home *** CD-ROM | disk | FTP | other *** search
Wrap
unit ComServer_TLB; // ************************************************************************ // // WARNING // ------- // The types declared in this file were generated from data read from a // Type Library. If this type library is explicitly or indirectly (via // another type library referring to this type library) re-imported, or the // 'Refresh' command of the Type Library Editor activated while editing the // Type Library, the contents of this file will be regenerated and all // manual modifications will be lost. // ************************************************************************ // // PASTLWTR : $Revision: 1.88 $ // File generated on 19/08/99 17:58:31 from Type Library described below. // *************************************************************************// // NOTE: // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties // which return objects that may need to be explicitly created via a function // call prior to any access via the property. These items have been disabled // in order to prevent accidental use from within the object inspector. You // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively // removing them from the $IFDEF blocks. However, such items must still be // programmatically created via a method of the appropriate CoClass before // they can be used. // ************************************************************************ // // Type Lib: D:\Magazines\Work In Progress\52 - Dec 99\Safecall\Files\ComServer.tlb (1) // IID\LCID: {8DD636AC-5643-11D3-96EC-0060978E1359}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\STDOLE2.TLB) // (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. interface uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL; // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions ComServerMajorVersion = 1; ComServerMinorVersion = 0; LIBID_ComServer: TGUID = '{8DD636AC-5643-11D3-96EC-0060978E1359}'; IID_IErrorTrappingTest: TGUID = '{8DD636AD-5643-11D3-96EC-0060978E1359}'; CLASS_ErrorTrappingTest: TGUID = '{8DD636AF-5643-11D3-96EC-0060978E1359}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// IErrorTrappingTest = interface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// ErrorTrappingTest = IErrorTrappingTest; // *********************************************************************// // Interface: IErrorTrappingTest // Flags: (256) OleAutomation // GUID: {8DD636AD-5643-11D3-96EC-0060978E1359} // *********************************************************************// IErrorTrappingTest = interface(IUnknown) ['{8DD636AD-5643-11D3-96EC-0060978E1359}'] procedure Error1; safecall; procedure Error2; safecall; procedure Error3; safecall; procedure Error4; safecall; procedure Error5; safecall; end; // *********************************************************************// // The Class CoErrorTrappingTest provides a Create and CreateRemote method to // create instances of the default interface IErrorTrappingTest exposed by // the CoClass ErrorTrappingTest. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoErrorTrappingTest = class class function Create: IErrorTrappingTest; class function CreateRemote(const MachineName: string): IErrorTrappingTest; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TErrorTrappingTest // Help String : ErrorTrappingTest Object // Default Interface: IErrorTrappingTest // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TErrorTrappingTestProperties= class; {$ENDIF} TErrorTrappingTest = class(TOleServer) private FIntf: IErrorTrappingTest; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TErrorTrappingTestProperties; function GetServerProperties: TErrorTrappingTestProperties; {$ENDIF} function GetDefaultInterface: IErrorTrappingTest; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: IErrorTrappingTest); procedure Disconnect; override; procedure Error1; procedure Error2; procedure Error3; procedure Error4; procedure Error5; property DefaultInterface: IErrorTrappingTest read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TErrorTrappingTestProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TErrorTrappingTest // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TErrorTrappingTestProperties = class(TPersistent) private FServer: TErrorTrappingTest; function GetDefaultInterface: IErrorTrappingTest; constructor Create(AServer: TErrorTrappingTest); protected public property DefaultInterface: IErrorTrappingTest read GetDefaultInterface; published end; {$ENDIF} procedure Register; implementation uses ComObj; class function CoErrorTrappingTest.Create: IErrorTrappingTest; begin Result := CreateComObject(CLASS_ErrorTrappingTest) as IErrorTrappingTest; end; class function CoErrorTrappingTest.CreateRemote(const MachineName: string): IErrorTrappingTest; begin Result := CreateRemoteComObject(MachineName, CLASS_ErrorTrappingTest) as IErrorTrappingTest; end; procedure TErrorTrappingTest.InitServerData; const CServerData: TServerData = ( ClassID: '{8DD636AF-5643-11D3-96EC-0060978E1359}'; IntfIID: '{8DD636AD-5643-11D3-96EC-0060978E1359}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TErrorTrappingTest.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as IErrorTrappingTest; end; end; procedure TErrorTrappingTest.ConnectTo(svrIntf: IErrorTrappingTest); begin Disconnect; FIntf := svrIntf; end; procedure TErrorTrappingTest.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TErrorTrappingTest.GetDefaultInterface: IErrorTrappingTest; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation'); Result := FIntf; end; constructor TErrorTrappingTest.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TErrorTrappingTestProperties.Create(Self); {$ENDIF} end; destructor TErrorTrappingTest.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TErrorTrappingTest.GetServerProperties: TErrorTrappingTestProperties; begin Result := FProps; end; {$ENDIF} procedure TErrorTrappingTest.Error1; begin DefaultInterface.Error1; end; procedure TErrorTrappingTest.Error2; begin DefaultInterface.Error2; end; procedure TErrorTrappingTest.Error3; begin DefaultInterface.Error3; end; procedure TErrorTrappingTest.Error4; begin DefaultInterface.Error4; end; procedure TErrorTrappingTest.Error5; begin DefaultInterface.Error5; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TErrorTrappingTestProperties.Create(AServer: TErrorTrappingTest); begin inherited Create; FServer := AServer; end; function TErrorTrappingTestProperties.GetDefaultInterface: IErrorTrappingTest; begin Result := FServer.DefaultInterface; end; {$ENDIF} procedure Register; begin RegisterComponents('Servers',[TErrorTrappingTest]); end; end.